package com.nbjtjc.safe.api.report;

import com.nbjtjc.safe.annotation.SysLog;
import com.nbjtjc.safe.service.report.DangerReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;

/**
 * @auther guqianbin
 * @date 2018/4/28 8:35
 * 隐患的报表导入导出
 **/
@RestController
@RequestMapping("/report")
@CrossOrigin("*")
public class DangerReportController {

    @Autowired
    private DangerReportService dangerReportService;

    @SysLog("下载安全检查计划表")
    @GetMapping("/dangerSafePlan/{dangerSafePlanId}")
    public void dangerSafePlanExcel(HttpServletResponse response
            ,@PathVariable("dangerSafePlanId") int dangerSafePlanId){
        dangerReportService.dangerSafePlanExcel(response,dangerSafePlanId);
    }

    @SysLog("下载该部门，当前年度所有检查的汇总")
    @GetMapping("/dangerInspectPublic/{year}")
    public void dangerInspectPublic(HttpServletResponse response
            ,@PathVariable("year") int year){
        dangerReportService.dangerInspectPublic(response,year);
    }

    @SysLog("下载获取某次检查的详情的excel")
    @GetMapping("/dangerInspectPublicDetailExcel/{dangerInspectPublicId}")
    public void dangerInspectPublicDetailExcel(HttpServletResponse response
            ,@PathVariable("dangerInspectPublicId") int dangerInspectPublicId){
        dangerReportService.dangerInspectPublicDetailExcel(response,dangerInspectPublicId);
    }


    @SysLog("下载返回隐患整改单的excel模板")
    @GetMapping("/dangerReformReplyExcel/{dangerReformReplyId}")
    public void dangerReformReplyExcel(HttpServletResponse response
            ,@PathVariable("dangerReformReplyId") int dangerReformReplyId){
        dangerReportService.dangerReformReplyExcel(response,dangerReformReplyId);
    }
}
